<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>无标题文档</title>
    <link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="<%=path%>/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/rl.js"></script>
    <script type="text/javascript">

        function deletes(id) {
            window.location.href = "<%=basePath%>deleteAdvice?daid=" + id;
        }

        function ky(id) {
            window.location.href = "<%=basePath%>showAllPrescribe?roid="+id;
        }
        function chgPageSize(size){
            document.forms[0].action="<%=basePath%>findSomeAdvice?pageNo=1&pageSize="+size;
            document.forms[0].submit();
            return false;
        }
        function goPage(pageNo){
            if(pageNo<1){
                return false;
            }
            if(pageNo>${advices.pageCount}){
                return false;
            }
            document.forms[0].action="<%=basePath%>findSomeAdvice?pageSize=${advices.pageSize}&pageNo="+pageNo;
            document.forms[0].submit();
            return false;
        }

        $(function () {
            $('tbody tr:odd').addClass("trLight");

            $(".select-all").click(function () {
                if ($(this).attr("checked")) {
                    $(".checkBox input[type=checkbox]").each(function () {
                        $(this).attr("checked", true);
                    });
                } else {
                    $(".checkBox input[type=checkbox]").each(function () {
                        $(this).attr("checked", false);
                    });
                }
            });

        });
    </script>
    <style type="text/css">
        body {
            background: #FFF
        }
    </style>
</head>

<body>
<div id="contentWrap">
    <!--表格控件 -->
    <div id="widget table-widget">
        <div class="pageTitle">医生诊断管理</div>
        <div class="querybody">
            <form action="<%=basePath%>findSomeAdvice">
                <ul class="seachform">
                    <li><label>挂号号</label><input name="roid" type="text" class="scinput"/></li>
                    <li><label>会员ID</label><input name="memberid" type="text" class="scinput"/></li>
                    <li><label>诊断时间</label><input name="createdate" id="yztime" type="date" class="scinput"/></li>
                    <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
                </ul>
            </form>

        </div>
        <div class="pageColumn">
            <div class="pageButton"><a href="<%=path%>/html/yzadd.jsp"><img src="<%=path%>/images/t01.png"
                                                                            title="新增"/></a><span>医生诊断结果列表</span></div>
            <table>
                <thead>
                <th width="">挂号号</th>
                <th width="">会员ID</th>
                <th width="">诊断人</th>
                <th width="">诊断时间</th>
                <th width="">诊断结果</th>
                <th width="">药方</th>
                <th width="10%">操作</th>
                <th width="10%">开药信息</th>
                </thead>
                <tbody>
                <c:forEach items="${advices.list}" var="advice">
                    <tr>
                        <td>${advice.roid}</td>
                        <td>${advice.memberid}</td>
                        <td>${advice.docname}</td>
                        <td><fmt:formatDate value="${advice.createdate}" pattern="yyyy-MM-dd"/> </td>
                        <td>${advice.results}</td>
                        <td>${advice.prescription}</td>
                        <td><a onclick="deletes(${advice.daid})"><img src="<%=path%>/images/icon/del.png" width="16"
                                                                      height="16"/></a></td>
                        <td><a onclick="ky(${advice.roid})"><img src="<%=path%>/images/icon/edit2.png" width="16"
                                                                 height="16"/></a>
                        </td>
                    </tr>
                </c:forEach>

                </tbody>
            </table>
        </div>
    </div><!-- #widget -->
    <div id="pagination" style="align:right;margin-top:-10px;">
        <div id='project_pagination' class="pagination pagination-centered">
            <div class="pagination">
                <ul>
                    <li ><a href="javascript:goPage(${advices.pageNo-1})">«</a></li>
                    <c:forEach begin="${advices.pageNo-2<1?1:advices.pageNo-2}" end="${advices.pageNo+2}" var="cnt">
                        <c:if test="${cnt>=1 and cnt<=advices.pageCount}">
                            <li class="${cnt==advices.pageNo?'active':''}"><a href="javascript:goPage(${cnt})">${cnt}</a></li>
                        </c:if>
                    </c:forEach>


                    <li><a href="javascript:goPage(${advices.pageNo+1})">»</a></li>
                </ul>
                <ul>
                    <li><span>(${advices.firstResult+1}-${advices.firstResult+advices.pageSize>advices.rowCount?advices.rowCount:advices.firstResult+advices.pageSize}/${advices.rowCount})</span></li>
                    <li><span>显示条数&nbsp;:&nbsp;</span></li>
                </ul>
                <ul>
                    <li class="${advices.pageSize==2?'active':''}"><a href="javascript:chgPageSize(2)">2</a></li>
                    <li class="${advices.pageSize==30?'active':''}"><a href="javascript:chgPageSize(30)">30</a></li>
                    <li class="${advices.pageSize==50?'active':''}"><a href="javascript:chgPageSize(50)">50</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>

